//
//  Small_StandbyLeft_01.swift
//  TimMusic
//
//  Created by nkl on 2024/10/25.
//

import Foundation
import SwiftUI

struct Small_StandbyLeft_02: View {
    var model: ControlMusicModel
    
    var body: some View {
        ZStack(alignment: .topTrailing) {
            Color.black.ignoresSafeArea()

            VStack(alignment: .leading) {
                HStack {
                    if let data = model.imageData, let uiImage = UIImage(data: data) {
                        Image(uiImage: uiImage).resizable()
                            .frame(width: 90, height: 90)
                            .cornerRadius(16)
                    } else {
                        Image("ic_small_placeholder").resizable()
                            .frame(width: 90, height: 90)
                            .cornerRadius(16)
                    }

                    Spacer()
                }

                Text(model.title).font(.system(size: 14).bold()).foregroundColor(Color(hex: "#C74B2A")).padding(.top, 8)
                Text(model.auth).font(.system(size: 10)).foregroundColor(Color(hex: "#C74B2A").opacity(0.8))
                
            }.padding()

            if model.isPlay {
                Image("ic_standby_pause")
                    .padding([.top, .trailing])
                    .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.pause.rawValue)", isStatic: model.isStatic))
            } else {
                Image("ic_standby_play")
                    .padding([.top, .trailing])
                    .modifier(AppClickModifier(urlString: "timMusic://musicControl?option=\(OptionType.play.rawValue)", isStatic: model.isStatic))
            }
        }
    }
}
